home *** CD-ROM | disk | FTP | other *** search
- //____________________________________________________________
- // QuickSpeech.c
- //
- // Copyright © Dan Parks Sydow, 1995
- // From the book:
- // "Graphics and Sound Programming Techniques for the Mac",
- // M&T Books, 1995
-
-
- //____________________________________________________________
-
- #include <Speech.h>
-
-
- //____________________________________________________________
-
- void InitializeToolbox( void );
- Boolean IsSpeechAvailable( void );
-
-
- //____________________________________________________________
-
- void main( void )
- {
- OSErr theError;
- Boolean speechPresent;
-
- InitializeToolbox();
-
- speechPresent = IsSpeechAvailable();
- if ( speechPresent == false )
- ExitToShell();
-
- theError = SpeakString( "\pTesting 1 2 3 Testing 1 2 3" );
- if ( theError != noErr )
- ExitToShell();
-
- // ** if you comment out the following two lines and recompile, **
- // ** you might not hear speech when the program runs. Read a **
- // ** few more pages into Chapter 4 to see why the program is **
- // ** ending before speech completes! **
-
- while ( SpeechBusy() == true )
- ;
-
- }
-
-
- //____________________________________________________________
-
- Boolean IsSpeechAvailable( void )
- {
- OSErr theError;
- long theResult;
- Boolean speechAvail;
-
- theError = Gestalt( gestaltSpeechAttr, &theResult );
- if ( theError != noErr )
- ExitToShell();
-
- speechAvail = theResult & ( 1 << gestaltSpeechMgrPresent );
- if ( speechAvail > 0 )
- return ( true );
- else
- return ( false );
- }
-
-
- //____________________________________________________________
-
- void InitializeToolbox( void )
- {
- InitGraf( &qd.thePort );
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs( 0L );
- FlushEvents( everyEvent, 0 );
- InitCursor();
- }
-
-
-
-